// 一些操作数据的类，集合了很多数据，就统一放在这里
var BizFunc = function () { }

BizFunc.prototype.resetActionArr = function () {
    window.GameViewData.actionArr = new Array();
    var showAction = cc.show();
    window.GameViewData.actionArr.push(showAction);
},
    BizFunc.prototype.resetRobotByStageConfig = function () {
        window.GameViewData.robot.localX = window.GameViewData.curStage.initLocalX;
        window.GameViewData.robot.localY = window.GameViewData.curStage.initLocalY;
        window.GameViewData.robot.dir = window.GameViewData.curStage.initDir;
        window.GameViewData.robot.node.stopAllActions();
        window.BizFunc.updatePointByLocal();
        window.BizFunc.updateRobot();
    },
    BizFunc.prototype.updatePointByLocal = function () {
        var pointIndex = window.GameViewData.curStage.rowNum * window.GameViewData.robot.localY + window.GameViewData.robot.localX;
        window.GameViewData.robot.pointX = window.GameViewData.curStage.landArr[pointIndex].node.x;
        window.GameViewData.robot.pointY = window.GameViewData.curStage.landArr[pointIndex].node.y;
    },
    BizFunc.prototype.updateRobot = function () {
        window.GameViewData.robot.node.x = window.GameViewData.robot.pointX;
        window.GameViewData.robot.node.y = window.GameViewData.robot.pointY;
        window.GameViewData.robot.node.angle = (window.GameViewData.robot.dir - window.GameEnum.DirEnum.DIR_RIGHT) * 90;
    },
    BizFunc.prototype.resetLandByStageConfig = function () {
        for (var i = 0; i < window.GameViewData.curStage.landPropertiesArr.length; i++) {
            window.GameViewData.curStage.landArr[i].state = window.GameViewData.curStage.landPropertiesArr[i].state;
            window.GameViewData.curStage.landArr[i].resetAppearance();
        }
    },
    BizFunc.prototype.resetSomeDynamicData = function () {
        window.GameViewData.dynamicData.completed = false;
        window.GameViewData.dynamicData.curStack = 0;
        window.GameViewData.dynamicData.target = 0;
    },

    BizFunc.prototype.resetDynamicData = function () {
        window.GameViewData.dynamicData = {};
        window.GameViewData.dynamicData.tokenArr = new Array();
        window.GameViewData.dynamicData.arrChange = true;
        window.GameViewData.dynamicData.result = "";
        window.GameViewData.dynamicData.target = 0;
        window.GameViewData.dynamicData.completed = false;
        window.GameViewData.dynamicData.func1TokenArr = new Array();
        window.GameViewData.dynamicData.func1ArrChange = true;
        window.GameViewData.dynamicData.func2TokenArr = new Array();
        window.GameViewData.dynamicData.func2ArrChange = true;
    },
    module.exports = BizFunc; 